
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8">
	<title>添加公告</title>
	<script th:src="@{/layui/layui.js}" type="text/javascript"></script>
	<link th:href="@{/layui/css/layui.css}" rel="stylesheet" />
	<script th:src="@{/js/selectM.js}" type="text/javascript"></script>
	<script th:src="@{/js/selectN.js}" type="text/javascript"></script>
	<link rel="stylesheet" th:href="@{/upload/css/publish.css}" media="all">
	<script type="text/javascript" th:src="@{/upload/js/move.js}"></script>
	<script type="text/javascript" th:src="@{/upload/js/publishImg.js}"></script>
	<!---->
	<!--<script type="text/javascript" th:src="@{/js/inputTag.js}"></script>
	<link th:href="@{/css/inputTag.css}" rel="stylesheet" />-->
</head>
<body>

<div class="layui-container" style="margin: 10px 0px;">

	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
		<legend>通知公告</legend>
	</fieldset>

	<form class="layui-form layui-form-pane">



		<div class="layui-form-item">
			<label class="layui-form-label">公告标题</label>
			<div class="layui-input-block">
				<input class="layui-input" lay-verify="required" name="title" autocomplete="off" placeholder="公告标题" />
			</div>
		</div>


		<!---->
		<div class="layui-form-item layui-form-text">
			<label class="layui-form-label">公告内容</label>
			<div class="layui-input-block">
				<textarea id="content"  class="layui-textarea" name="content"></textarea>
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">发布管理员id</label>
				<div class="layui-input-inline">
					<input class="layui-input" name="adminId" lay-verify="required" autocomplete="off" />
				</div>
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">新增时间</label>
			<div class="layui-input-inline">
				<input type="text" name="addTime" id="addTime" lay-verify="datetime" class="layui-input" />
			</div>
		</div>

<!--		<div class="layui-form-item">-->
<!--			<label class="layui-form-label">更新时间</label>-->
<!--			<div class="layui-input-block">-->
<!--				<input class="layui-input" lay-verify="required" name="keyword" autocomplete="off" placeholder="关键字名称" />-->
<!--			</div>-->
<!--		</div>-->

		<div class="layui-form-item">
			<div style="text-align: center;display: none">
				<a class="layui-btn  layui-btn-normal" id="submitBtn" lay-submit="" lay-filter="submitBtn">
					<i class="layui-icon layui-icon-ok"></i>
					确定保存
				</a>
				<a class="layui-btn layui-btn-primary" id="cleanBtn">
					<i class="layui-icon layui-icon-fonts-clear"></i>
					清空重置
				</a>
			</div>
		</div>

	</form>

</div>

<script>


	var $;
	layui.use(['layedit','laydate','table','form','jquery','layer','layedit','element','selectN','selectM'],function(){
		$ = layui.jquery;
		var form = layui.form,
				layer = layui.layer,
				layedit = layui.layedit,
				laydate = layui.laydate;

		//
		// //清空
		// $('#cleanBtn').on('click',function(){
		// 	$('.layui-form input').val("");
		// 	$('.layui-textarea').val("");
		// })

		laydate.render({
			elem: '#addTime' //指定元素
		});

		// layedit.build('demo'); //建立编辑器



		form.on('submit(submitBtn)',function (data) {
			var formData =  data.field;
			console.log(formData);
			$.ajax({
				type:'post',
				url:'/notice/nc/add',
				data:formData,
				dataType:'json',
				success:function (result) {
					layer.msg(result.msg);
					if (result.is){
						let index = parent.layer.getFrameIndex(window.name);
						parent.layer.close(index);  //编辑成功后关闭父页面窗口
						parent.layui.table.reload('noticeTable');//根据表格id刷新父页面表格
					}
				}
			})
		})

	});

	function btnSubmit(){
		$('#submitBtn').click();
	}




</script>

</body>
</html>

